<!--
 * @Author: your name
 * @Date: 2020-07-22 15:10:16
 * @LastEditTime: 2020-07-27 16:16:34
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \暑期前端培训\5. Javascript   核心DOM BOM操作\js核心DOM BOM操作 03\06-innerHTML拼接效率测试.html
--> 
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>效率测试</title>
</head>

<body>
</body>
<script>
    function fn() {
        var d1 = +new Date();
        console.log(d1);

        var str = '';
        for (var i = 0; i < 1000; i++) {
            document.body.innerHTML += '<div style="width:100px; height:2px; border:1px solid blue;"></div>';
        }
        var d2 = +new Date();
        console.log(d2);
        console.log(d2 - d1);
    }
    fn();
</script>

</html>